package abstractEntities;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.MappedSuperclass;
import org.hibernate.annotations.GenericGenerator;

import entities.User;

/**
 * AbstractAward entity provides the base persistence definition of the Award
 * entity. @author MyEclipse Persistence Tools
 */
@MappedSuperclass
public abstract class AbstractAward implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 1347207268670031401L;
	private Integer idAward;
	private String imgAward;
	private String text;
	private Set<User> users = new HashSet<User>(0);

	// Constructors

	/** default constructor */
	public AbstractAward() {
	}

	/** minimal constructor */
	public AbstractAward(String imgAward, String text) {
		this.imgAward = imgAward;
		this.text = text;
	}

	/** full constructor */
	public AbstractAward(String imgAward, String text, Set<User> users) {
		this.imgAward = imgAward;
		this.text = text;
		this.users = users;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "increment")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "IdAward", unique = true, nullable = false)
	public Integer getIdAward() {
		return this.idAward;
	}

	public void setIdAward(Integer idAward) {
		this.idAward = idAward;
	}

	@Column(name = "imgAward", nullable = false, length = 75)
	public String getImgAward() {
		return this.imgAward;
	}

	public void setImgAward(String imgAward) {
		this.imgAward = imgAward;
	}

	@Column(name = "text", nullable = false)
	public String getText() {
		return this.text;
	}

	public void setText(String text) {
		this.text = text;
	}

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "awards")
	public Set<User> getUsers() {
		return this.users;
	}

	public void setUsers(Set<User> users) {
		this.users = users;
	}

}